package com.zjc.activiti;

import com.zjc.bean.OrderBean;
import com.zjc.bean.OrderSubBean;
import com.zjc.service.SubService;
import org.activiti.engine.RuntimeService;
import org.junit.Test;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class MultiActiviti extends BaseActiviti {

    @Test
    public  void deploy(){
        this.baseDeploy("multi_main_process.bpmn");
        this.baseDeploy("multi_sub_process.bpmn");
    }

    @Test
    public void startProcess(){
        RuntimeService runtimeService=this.processEngine.getRuntimeService();
        Map<String,Object> map=new HashMap<>();
        OrderBean orderBean=new OrderBean();
        orderBean.setSubBeanList(Arrays.asList(new OrderSubBean("multi_sub_process")));
        map.put("order",orderBean);
        map.put("_test", "哈哈哈");
        map.put("subService",new SubService());
        runtimeService.startProcessInstanceByKey("multi_main_process",map);
    }
}
